home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / gfx / show / MysticView0_68.lha / mysticview / source / global.c next >
C/C++ Source or Header  |  1996-12-29  |  3KB  |  119 lines

  1. /*********************************************************************
  2. ----------------------------------------------------------------------
  3.  
  4.     MysticView Global Data
  5.  
  6. ------------------------------------------------------ tabsize = 4 ---
  7. *********************************************************************/
  8.  
  9. #include <string.h>
  10.  
  11. #include <exec/memory.h>
  12. #include <proto/exec.h>
  13. #include <proto/render.h>
  14. #include <render/render.h>
  15.  
  16. #include "global.h"
  17.  
  18. /*------------------------------------------------------------------*/
  19.  
  20. static char versionstring[] = "$VER: " PROGNAME;
  21.  
  22. /*------------------------------------------------------------------*/
  23.  
  24. APTR memhandler;
  25. struct Library *RenderBase;
  26. struct Library *DataTypesBase;
  27.  
  28. /*********************************************************************
  29. ----------------------------------------------------------------------
  30.  
  31.     BOOL InitGlobal(void)
  32.  
  33. ----------------------------------------------------------------------
  34. *********************************************************************/
  35.  
  36. BOOL InitGlobal(void)
  37. {
  38.     /*
  39.      * open render.library
  40.      */
  41.  
  42.     if(RenderBase = OpenLibrary("render.library", RENDER_VERSION))
  43.     {
  44.  
  45.         if(DataTypesBase = OpenLibrary("datatypes.library", 39L))
  46.         {
  47.  
  48.             /*
  49.              * create a global memory handler with render.library
  50.              */
  51.  
  52.             if(memhandler = CreateRMHandler(RND_MemType, RMHTYPE_POOL, TAG_DONE))
  53.             {
  54.                 return TRUE;    
  55.             }    
  56.         }
  57.     }
  58.  
  59.     return FALSE;
  60. }
  61.  
  62. /*********************************************************************
  63. ----------------------------------------------------------------------
  64.  
  65.     void CloseGlobal(void)
  66.  
  67. ----------------------------------------------------------------------
  68. *********************************************************************/
  69.  
  70. void CloseGlobal(void)
  71. {
  72.     if (memhandler)
  73.     {
  74.         DeleteRMHandler(memhandler);
  75.     }
  76.  
  77.     if (DataTypesBase)
  78.     {
  79.         CloseLibrary(DataTypesBase);
  80.     }
  81.  
  82.     if (RenderBase)
  83.     {
  84.         CloseLibrary(RenderBase);
  85.     }
  86.  
  87. }
  88.  
  89.  
  90.  
  91. /*********************************************************************
  92. ----------------------------------------------------------------------
  93.  
  94.     mem = AllocVecPooled(size)
  95.  
  96. ----------------------------------------------------------------------
  97. *********************************************************************/
  98.  
  99. APTR AllocVecPooled( ULONG allocsize )
  100. {
  101.     return AllocRenderVec( memhandler, allocsize );
  102. }
  103.  
  104.  
  105. /*********************************************************************
  106. ----------------------------------------------------------------------
  107.  
  108.     FreeVecPooled(mem)
  109.  
  110. ----------------------------------------------------------------------
  111. *********************************************************************/
  112.  
  113. void FreeVecPooled( APTR memblock )
  114. {
  115.     FreeRenderVec( memblock );
  116. }
  117.  
  118.  
  119.